package com.punai.common.bos;

public class RestBodyResponse<T> {
	private Integer code; //反馈代码
	private String message;//反馈描述
	private String devMessage;//反馈实际信息
	private T body;//反馈数据

	private RestBodyResponse(){
		this(0,null,null,null);
	}
	private RestBodyResponse(Integer code, String message, String devMessage){
		this(code,message,devMessage,null);
	}
	private RestBodyResponse(T data){
		this(0,null,null,data);
	}
	private RestBodyResponse(String message, String devMessage, T data){
		this(0,message,devMessage,data);
	}
	private RestBodyResponse(Integer code, String message, String devMessage, T data) {
		super();
		this.code = code;
		this.message = message;
		this.devMessage = devMessage;
		this.body = data;
	}
	public static <T> RestBodyResponse<T> ok(){
		return new RestBodyResponse<T>();
	}
	public static <T> RestBodyResponse<T> ok(T data){
		return new RestBodyResponse<T>(data);
	}
	public static <T> RestBodyResponse<T> ok(String message, String devMessage, T data){
		return new RestBodyResponse<T>(message,devMessage,data);
	}
	public static <T> RestBodyResponse<T> fail(String message, String devMessage){
		return new RestBodyResponse<T>(1,message,devMessage);
	}
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public String getDevMessage() {
		return devMessage;
	}
	public void setDevMessage(String devMessage) {
		this.devMessage = devMessage;
	}

	public T getBody() {
		return body;
	}

	public void setBody(T body) {
		this.body = body;
	}

	@Override
	public String toString() {
		return "FeedbackInfo [code=" + code + ", message=" + message
				+ ", devMessage=" + devMessage + ", body=" + body + "]";
	}
	
	

}
